/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: CommodityController
 * Author:   pc
 * Date:     2019/9/2 16:07
 * Description: 商品逻辑层
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.example.rabbitmqdemo.controller;

import com.example.rabbitmqdemo.entity.Commodity;
import com.example.rabbitmqdemo.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 〈功能：〉<br> 
 * 〈商品逻辑层〉
 * @author liuhaoran
 * @create 2019/9/2 16:07
 * @since 1.0.0
 */
@Controller
public class CommodityController {
	@Autowired
	CommodityService commodityservice;
	@PostMapping("/listcommodity")
	public List<Commodity> getCommodityList(){
		List<Commodity> listCommodity=new ArrayList<>();
		listCommodity=commodityservice.getCommodityList();
		return	listCommodity;
	}
	@ResponseBody
	@PostMapping("/findcommodityid")
	public Map<String,Object> selectCommoditybyid(@RequestParam(value = "id")int id){
		Map<String,Object> listCommodity=commodityservice.selectComodityById(id);
		return	listCommodity;
	}

}